package priv.pront.code.robot.roboCom_pri_2021.zhi;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-07-09 17:45
 */
public class 救救倒霉鬼 {

    static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    static int n, m;
    static Set<String> set = new TreeSet<>();
    static List<String> list = new ArrayList<>();
    public static void main(String[] args) throws IOException {
        n = Integer.parseInt(bf.readLine());
        for (int i = 0; i < n; i++) {
            String s = bf.readLine();
            set.add(s);
        }
        m = Integer.parseInt(bf.readLine());
        for (int i = 0; i < m; i++) {
            String s = bf.readLine();
            set.remove(s);
        }
        for (String s : set) {
            list.add(s);
        }
        for (int i = list.size() - 1; i >= 0; i--) {
            System.out.println(list.get(i));
        }

    }
}
